public class StringDemo3 {
    /**
     * @author dengjiangming
     * @date 2025-06-19
     * @version 1.0.0
     */

    //替换字符串中的特定字符
    public static void main(String[] args) {
        String s = "ababcabcd";
        String tmp = s.replace('a','p');
        System.out.println(tmp);

        tmp = s.replace("ab","os");
        System.out.println(tmp);

        tmp = s.replaceFirst("abc","oop");
        System.out.println(tmp);

        tmp = s.replaceAll("ab","oooo");
        System.out.println(tmp);
    }
}
